<template>
	<div>
		<el-row :gutter="24">
			<el-col :span="24">
				<el-row :gutter="24">
					<el-col :span="1" style="">
						<p class="queryLabel">车系:</p>
					</el-col>
					<el-col :span="3">
						<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
						</el-input>
					</el-col>
					<el-col :span="2" style="text-align: right;">
						<p class="queryLabel">车辆型号:</p>
					</el-col>
					<el-col :span="3">
						<el-select size="small" style="width: 100%;" v-model="carSelect.carModelCode" placeholder="请选择配置" clearable @change="changeModel">
							<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1" style="">
						<p class="queryLabel">车辆配置:</p>
					</el-col>
					<el-col :span="3">
						<el-select size="small" style="width: 100%;" v-model="carSelect.carConfigureCode" placeholder="请选择配置" clearable>
							<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="2" style="text-align: right;">
						<p class="queryLabel">发票日期:</p>
					</el-col>
					<el-col :span="3">
						<el-date-picker v-model="data.firstStart" size="small" style="width:100%;" type="date" clearable placeholder="开始日期">
						</el-date-picker>
					</el-col>
					<el-col :span="1" style="">
						<p class="queryLabel">至:</p>
					</el-col>
					<el-col :span="3">
						<el-date-picker v-model="data.firstStarts" size="small" style="width:100%;" type="date" clearable placeholder="结束日期">
						</el-date-picker>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="1" style="">
						<p class="queryLabel">车主:</p>
					</el-col>
					<el-col :span="3">
						<el-input placeholder="请输入车主" size="small" v-model="carSelect.owner">
						</el-input>
					</el-col>
					<el-col :span="2" style="text-align: right;">
						<p class="queryLabel">作废状态:</p>
					</el-col>
					<el-col :span="3">
						<el-select size="small" v-model="carSelect.status" placeholder="请选择状态" >
							<el-option v-for="item in statusCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					
					<el-col :span="1" style="">
						<p class="queryLabel">VIN:</p>
					</el-col>
					<el-col :span="3">
						<el-input placeholder="请输入VIN" size="small" v-model="carSelect.vin">
						</el-input>
					</el-col>
					<el-col :span="2" style="text-align: right;">
						<p class="queryLabel">打印状态:</p>
					</el-col>
					<el-col :span="3">
						<el-select size="small" v-model="carSelect.printType" placeholder="请选择状态" clearable>
							<el-option v-for="item in prentCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="5" style="text-align: right;">
						<el-button type="primary" size="small" @click="query">查 询</el-button>
						<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
						<el-button type="primary" size="small" @click="toVoid">作 废</el-button>
					</el-col>
					<el-col :span="23" style="text-align: right;">
						<el-button type="primary" size="small" @click="add">新增普票</el-button>
						<el-button type="primary" size="small" @click="adds">新增专票</el-button>
						<el-button type="primary" size="small" @click="edit">查看详情</el-button>
						<el-button type="primary" size="small" @click="print">打印出库单</el-button>
						<el-button type="primary" size="small" @click="prints" v-if="btnGroup.prient">出库单补打</el-button>
						<el-button type="primary" size="small" @click="printr">打印红冲计价单</el-button>
						<el-button type="primary" size="small" @click="getCar">刷新车辆</el-button>
					</el-col>
				</el-row>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<el-table :data="tableData.dataList" stripe border @selection-change="handleSelectionChange">
					<el-table-column type="selection" width="55" label="选择" fixed></el-table-column>
					<el-table-column prop="invoiceHeader" label="车主姓名" width="100">
					</el-table-column>
					<el-table-column prop="invoiceDate" label="发票时间" width="120">
					</el-table-column>
					<el-table-column prop="invoiceNum" label="发票号" width="150">
					</el-table-column>

					<el-table-column prop="invoicePrice" label="开票金额" width="100">
					</el-table-column>
					<el-table-column prop="saleOrderPrice" label="车辆销售金额" width="120">
					</el-table-column>
					<el-table-column prop="saleStatus" label="出库状态" :formatter="statusCov" width="100">
					</el-table-column>
					<el-table-column prop="printType" label="打印状态" width="100">
					</el-table-column>
					<el-table-column prop="saleStatus" label="作废状态" :formatter="statusCovs" width="100">
					</el-table-column>
					<el-table-column prop="vin" label="VIN" width="180">
					</el-table-column>
					<el-table-column prop="carSeriesName" label="车型" width="100">
					</el-table-column>
					<el-table-column prop="carModel" label="车型" width="150">
					</el-table-column>
					<el-table-column prop="configureName" label="配置" width="170">
					</el-table-column>

					<el-table-column prop="owenPhone" label="联系电话" width="120">
					</el-table-column>
					<el-table-column prop="certificatesNum" label="身份证号" width="170">
					</el-table-column>
					<el-table-column prop="birthday" label="车主生日" width="120">
					</el-table-column>
					<!--销售价格改为以下几个字段-->
					<!--<el-table-column prop="saleOrderPrice" label="销售价格" width="100">
					</el-table-column>-->
					<el-table-column prop="equipmentPrice" label="装具价格" width="100">
					</el-table-column>
					<el-table-column prop="exsurancePrice" label="延保价格" width="100">
					</el-table-column>
					<el-table-column prop="agencyPrice" label="代办价格" width="100">
					</el-table-column>
					<el-table-column prop="otherPrice" label="其他附件价格" width="120">
					</el-table-column>
					<!----------------------------------------------->
					<el-table-column prop="invoicePrice" label="仓库" width="100" :formatter="warehouseCovs">
					</el-table-column>
					<el-table-column prop="saler" label="销售专员" width="100">
					</el-table-column>
					<!--<el-table-column prop="customerType" label="客户类型">
					</el-table-column>-->
					<el-table-column prop="createTime" label="创建日期" :formatter="timeMoment" width="120">
					</el-table-column>
				</el-table>
				<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>
			</el-col>
		</el-row>
		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
		<el-dialog title="销售发票登记" v-model="comFormShows" size="large">
			<el-row>
				<el-col :span="24">
					<el-collapse v-model="activeName">
						<el-collapse-item title="销售信息" name="1">
							<el-form :model="infoData" ref="comForm" label-width="130px" :rules="rules">
								<el-col :span="6">
									<el-form-item label="销售单编号：" prop="saleOrderNum">
										<el-input size="small" v-model="infoData.saleOrderNum" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户姓名：" prop="customerName">
										<el-input size="small" v-model="infoData.customerName" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户电话：" prop="contactPhone">
										<el-input size="small" v-model="infoData.contactPhone" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<!--<el-col :span="6">
								<el-form-item label="车主姓名：" prop="owenName">
									<el-input size="small" v-model="infoData.owenName" :readonly="readType"></el-input>
								</el-form-item>
							</el-col>-->
								<!--<el-col :span="6">
								<el-form-item label="车主电话：" prop="owenPhone">
									<el-input size="small" v-model="infoData.owenPhone" :readonly="readType"></el-input>
								</el-form-item>
							</el-col>-->
								<el-col :span="6">
									<el-form-item label="车主生日：" prop="birthday">
										<el-date-picker v-model="infoData.birthday" size="small" style="width:100%;" type="date" clearable placeholder="出生日期" :disabled=false :readonly="readType">
										</el-date-picker>
										<!--<el-input size="small" v-model="birthday" :readonly="readType"></el-input>-->
									</el-form-item>
								</el-col>
								<!--<el-col :span="6">
								<el-form-item label="证件类型：" prop="certificatesType">
									<el-select size="small" style="width: 100%; margin-left: -2px;" v-model="infoData.certificatesType" placeholder="请选择证件类型" clearable>
										<el-option v-for="item in cardType" :label="item.label" :value="item.value"></el-option>
									</el-select>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="证件号码：" prop="certificatesNum">
									<el-input size="small" v-model="infoData.certificatesNum"></el-input>
								</el-form-item>
							</el-col>-->
								<!--<el-col :span="6">
								<el-form-item label="车型：" prop="carModelCode">
									<el-input placeholder="请选择车型" size="small" icon="search" :readonly="readType" v-model="carModelCodes" :on-icon-click="handleIconClick">
									</el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="配置：" prop="configure">
									<el-select size="small" style="width: 100%;" v-model="infoData.configure" :disabled="infoData.saleStatus!=0" placeholder="请选择配置" clearable>
										<el-option v-for="item in configCombos" :label="item.label" :value="item.value"></el-option>
									</el-select>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="车身颜色：" prop="outsideColor">
									<el-input size="small" v-model="infoData.outsideColor" :readonly="readType"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="内饰颜色：" prop="insideColorCode">
									<el-input size="small" v-model="infoData.insideColorCode" :readonly="readType"></el-input>
								</el-form-item>
							</el-col>-->
								<el-col :span="6">
									<el-form-item label="付款方式：" prop="payType">
										<!--<el-input size="small" v-model="infoData.payType"></el-input>-->
										<el-select size="small" style="width: 100%; margin-left: -2px;" v-model="infoData.payType" placeholder="请选择付款方式" clearable :disabled=false :readonly="readType">
											<el-option v-for="item in payType" :label="item.label" :value="item.value"></el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="销售员：" prop="saler">
										<el-input size="small" v-model="infoData.saler" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<!--<el-col :span="6">
								<el-form-item label="数量：">
									<el-input size="small" v-model="carNumber" :readonly=true></el-input>
								</el-form-item>
							</el-col>-->
								<!--<el-col :span="6">
								<el-form-item label="销售状态：" prop="saleStatus">
									<el-select size="small" v-model="infoData.saleStatus" placeholder="请选择状态" clearable>
										<el-option v-for="item in saleType" :label="item.label" :value="item.value"></el-option>
									</el-select>
								</el-form-item>
							</el-col>-->
								<el-col :span="6">
									<el-form-item label="车架号：" prop="vin">
										<el-input size="small" v-model="infoData.vin" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="发动机号：" prop="engineNum">
										<el-input size="small" v-model="infoData.engineNum" readonly></el-input>
									</el-form-item>
								</el-col>
								<!--<el-col :span="6">
								<el-form-item label="销售价格：" prop="saleOrderPrice">
									<el-input size="small" v-model="infoData.saleOrderPrice" readonly></el-input>
								</el-form-item>
							</el-col>-->
								<el-col :span="6">
									<el-form-item label="车型名称：" prop="modelName">
										<el-input size="small" v-model="infoData.modelName" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="配置：" prop="configureName">
										<el-input size="small" v-model="infoData.configureName" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="车辆仓库：" prop="warehouse">
										<el-select size="small" v-model="infoData.warehouse" placeholder="未找到仓库" readonly>
											<el-option v-for="item in warehouseType" :label="item.label" :value="item.value"></el-option>
										</el-select>
										<!--<el-input size="small" v-model="infoData.warehouse" readonly></el-input>-->
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="初次入库日期：" prop="firstEnterWarehouseDate">
										<el-input size="small" v-model="infoData.firstEnterWarehouseDate" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="数量：">
										<!-- <el-input-number v-model="carNumber" @change="carNumberChange" :min="1" :max="10"></el-input-number>-->
										<el-input size="small" v-model="carNumber" :readonly=true></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6" style="text-align: right;">
									<el-button type="primary" size="small" @click="matchCar(0)">车辆筛选</el-button>
									<!--<el-button type="primary" size="small" @click="changeCar" v-if="infoData.saleStatus!=0">申请换车</el-button>-->
								</el-col>
								<el-col :span="6">
									<el-form-item label="装具价格：" prop="equipmentPrice">
										<el-input size="small" v-model="infoData.equipmentPrice" :readonly="false"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="延保价格：" prop="exsurancePrice">
										<el-input size="small" v-model="infoData.exsurancePrice" :readonly="false"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="代办价格：" prop="agencyPrice">
										<el-input size="small" v-model="infoData.agencyPrice" :readonly="false"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="其他附件价格：" prop="otherPrice">
										<el-input size="small" v-model="infoData.otherPrice" :readonly="false"></el-input>
									</el-form-item>
								</el-col>
							</el-form>
						</el-collapse-item>
					</el-collapse>
					<!--<el-card class="box-card-car">
						<el-form :model="infoData" ref="comForm" label-width="130px">
							
						</el-form>
					</el-card>-->
					<el-collapse v-model="activeNames">
						<el-collapse-item title="发票信息" name="1">
							<el-form :model="infoData" ref="comForm" label-width="130px" :rules="rules">
								<el-col :span="6">
									<el-form-item label="发票编号：" prop="invoiceNum">
										<el-input size="small" v-model="infoData.invoiceNum" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="开票日期：" prop="invoiceDate">
										<el-date-picker v-model="infoData.invoiceDate" size="small" style="width:100%;" type="date" clearable placeholder="开票日期" :disabled=false>
										</el-date-picker>
										<!--<el-input size="small" v-model="invoiceDate" :readonly="readType"></el-input>-->
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="开票金额(含税)：" prop="invoicePrice">
										<el-input size="small" v-model="infoData.invoicePrice" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="车辆销售金额(含税)：" prop="saleOrderPrice">
										<el-input size="small" v-model="infoData.saleOrderPrice" :readonly="false"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="发票抬头：" prop="invoiceHeader">
										<el-input size="small" v-model="infoData.invoiceHeader" icon="search" :readonly="false" :on-icon-click="handleIconClickCustomer">
										</el-input>
										<!--<el-select size="small" style="width: 100%;" v-model="infoData.invoiceHeader" placeholder="请选择发票单位" clearable @change="changeCustomer">
											<el-option v-for="item in customerCombos" :label="item.customerNick" :value="item.customerNick"></el-option>
										</el-select>-->
										<!--<el-input size="small" v-model="infoData.invoiceHeader" :readonly="readType"></el-input>-->
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户证件号码：" prop="certificatesNum">
										<el-input size="small" v-model="infoData.certificatesNum" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="联系电话：" prop="owenPhone">
										<el-input size="small" v-model="infoData.owenPhone" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
							</el-form>
						</el-collapse-item>
					</el-collapse>
				</el-col>
				<el-col :span="8" style="text-align: right;">
					<el-button v-if="true" type="primary" size="small" @click="saveOrder" style="width: 100px;">保 存</el-button>
				</el-col>
				<el-col :span="8" style="text-align: right;">
					<el-button type="primary" size="small" @click="comFormShows=false" style="width: 100px;">关 闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="销售发票登记" v-model="comFormShowsL" size="large">
			<el-row>
				<el-col :span="24">
					<el-collapse v-model="activeName">
						<el-collapse-item title="销售信息" name="1">
							<el-form :model="infoData" ref="comForm" label-width="130px" :rules="rules">
								<el-col :span="6">
									<el-form-item label="销售单编号：" prop="saleOrderNum">
										<el-input size="small" v-model="infoData.saleOrderNum" readonly></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户姓名：" prop="customerName">
										<el-input size="small" v-model="infoData.customerName" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户电话：" prop="contactPhone">
										<el-input size="small" v-model="infoData.contactPhone" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="车主生日：" prop="birthday">
										<el-date-picker v-model="infoData.birthday" size="small" style="width:100%;" type="date" clearable placeholder="出生日期" :disabled=false :readonly="readType">
										</el-date-picker>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="付款方式：" prop="payType">
										<el-select size="small" style="width: 100%; margin-left: -2px;" v-model="infoData.payType" placeholder="请选择付款方式" clearable :disabled=false :readonly="readType">
											<el-option v-for="item in payType" :label="item.label" :value="item.value"></el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="销售员：" prop="saler">
										<el-input size="small" v-model="infoData.saler" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>

								<el-col :span="6">
									<el-form-item label="数量：">
										<el-input size="small" v-model="infoData.carCount" :readonly=true></el-input>
									</el-form-item>
								</el-col>
							</el-form>
						</el-collapse-item>
						<el-collapse-item name="2">
							<template slot="title" style="text-align-last: right;">
								发票信息
							</template>
							<el-col :span="24">
								<el-button type="primary" size="small" @click="matchCar(1)" style="margin-left: 95%;">选择车辆</el-button>
							</el-col>
							<el-col :span="24">
								<div style="height: 10px;">
								</div>
							</el-col>
							<el-table :data="carList" border style="width: 100%;">
								<el-table-column prop="vin" label="VIN" width="180">
								</el-table-column>
								<el-table-column prop="modelName" label="车型名称" width="150">
								</el-table-column>
								<el-table-column prop="configureName" label="配置名称" width="150">
								</el-table-column>
								<el-table-column prop="warehouseId" label="所在仓库" width="100" :formatter="warehouseCov">
								</el-table-column>
								<el-table-column prop="firstEnterWarehouseDate" label="入库日期" width="100">
								</el-table-column>
								<el-table-column label="销售金额(含税)" align="right" prop="saleOrderPrice" width="150">
									<template scope="scope">
										<input v-model="scope.row.saleOrderPrice" class='table_input'>
									</template>
								</el-table-column>
								<el-table-column label="装具价格" align="right" prop="equipmentPrice" width="100">
									<template scope="scope">
										<input v-model="scope.row.equipmentPrice" class='table_input'>
									</template>
								</el-table-column>
								<el-table-column label="延保价格" align="right" prop="exsurancePrice" width="100">
									<template scope="scope">
										<input v-model="scope.row.exsurancePrice" class='table_input'>
									</template>
								</el-table-column>
								<el-table-column label="代办价格" align="right" prop="agencyPrice" width="100">
									<template scope="scope">
										<input v-model="scope.row.agencyPrice" class='table_input'>
									</template>
								</el-table-column>
								<el-table-column label="其他附件价格" align="right" prop="otherPrice" width="100">
									<template scope="scope">
										<input v-model="scope.row.otherPrice" class='table_input'>
									</template>
								</el-table-column>
								<el-table-column label="操作" align="right" width="80">
									<template scope="scope">
										<el-button type="primary" size="mini" @click.native.prevent="removeCar(scope.$index)">移除</el-button>
									</template>
								</el-table-column>
							</el-table>
						</el-collapse-item>
					</el-collapse>
					<el-collapse v-model="activeNames">
						<el-collapse-item title="发票信息" name="1">
							<el-form :model="infoData" ref="comForm" label-width="140px" :rules="rules">
								<el-col :span="6">
									<el-form-item label="发票编号：" prop="invoiceNum">
										<el-input size="small" v-model="infoData.invoiceNum" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="开票日期：" prop="invoiceDate">
										<el-date-picker v-model="infoData.invoiceDate" size="small" style="width:100%;" type="date" clearable placeholder="开票日期" :disabled=false>
										</el-date-picker>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="开票金额(含税)：" prop="invoicePrice">
										<el-input size="small" v-model="infoData.invoicePrice" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<!--<el-form-item label="车辆销售金额：" prop="saleOrderPrice">
										<el-input size="small" v-model="infoData.saleOrderPrice" :readonly="false"></el-input>
									</el-form-item>-->
								</el-col>
								<el-col :span="6">
									<el-form-item label="发票抬头：" prop="invoiceHeader">
										<el-input size="small" v-model="infoData.invoiceHeader" icon="search" :readonly="false" :on-icon-click="handleIconClickCustomer">
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="客户证件号码：" prop="certificatesNum">
										<el-input size="small" v-model="infoData.certificatesNum" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="6">
									<el-form-item label="联系电话：" prop="owenPhone">
										<el-input size="small" v-model="infoData.owenPhone" :readonly="readType"></el-input>
									</el-form-item>
								</el-col>
							</el-form>
						</el-collapse-item>
					</el-collapse>
				</el-col>
				<el-col :span="8" style="text-align: right;">
					<el-button v-if="true" type="primary" size="small" @click="saveOrderL" style="width: 100px;">保 存</el-button>
				</el-col>
				<el-col :span="8" style="text-align: right;">
					<el-button type="primary" size="small" @click="comFormShowsL=false" style="width: 100px;">关 闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="选择客户" v-model="showStarts" size="tiny">
			<el-row>
				<el-col :span="18">
					<el-select size="small" style="width: 100%;" v-model="infoData.invoiceHeader" placeholder="请选择发票单位" clearable>
						<el-option v-for="item in customerCombos" :label="item.customerNick" :value="item.customerNick"></el-option>
					</el-select>
				</el-col>
				<el-col :span="4" style="text-align: right">
					<el-button type="primary" v-on:click='changeCustomer'>确认</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="选择车辆" v-model="comFormShowCar" size="small">
			<el-row>
				<el-col :span="2">
					<p class="queryLabel">车架号:</p>
				</el-col>
				<el-col :span="6">
					<el-input size="small" style="width: 90%;" v-model="car.vin" placeholder="请输入车架号">
					</el-input>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='carQuery'>查询</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-table :data="tableDataCar.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges">
						<el-table-column type="selection" width="60">
						</el-table-column>
						<el-table-column prop="vin" label="VIN" width="180">
						</el-table-column>
						<el-table-column prop="estimatePrice" label="暂估价格" width="100">
						</el-table-column>
						<el-table-column prop="invoicePrice" label="发票金额" width="100">
						</el-table-column>
						<el-table-column prop="warehouseId" label="所在仓库" width="100" :formatter="warehouseCov">
						</el-table-column>
						<el-table-column prop="purchaseDate1" label="采购日期" width="120">
						</el-table-column>
						<el-table-column prop="purchaseNum" label="采购单号" width="100">
						</el-table-column>
						<el-table-column prop="carSeries" label="车系名称" width="150">
						</el-table-column>
						<el-table-column prop="modelName" label="车型名称" width="150">
						</el-table-column>
						<el-table-column prop="configureCode" label="配置代码" width="100">
						</el-table-column>
						<el-table-column prop="configureName" label="配置名称" width="150">
						</el-table-column>
						<el-table-column prop="carModelYear" label="车型年" width="100">
						</el-table-column>
						<el-table-column prop="appearanceCode" label="外观代码" width="100">
						</el-table-column>
						<el-table-column prop="appearanceName" label="外观颜色" width="120">
						</el-table-column>
						<el-table-column prop="trimCode" label="内饰代码" width="100">
						</el-table-column>
						<el-table-column prop="trimName" label="内饰名称" width="100">
						</el-table-column>
						<el-table-column prop="chooseCode" label="加装代码" width="100">
						</el-table-column>
						<el-table-column prop="chooseName" label="加装名称" width="100">
						</el-table-column>
						<el-table-column prop="distributionDate" label="配货日期" width="120">
						</el-table-column>
						<el-table-column prop="sendDate" label="发货日期" width="120">
						</el-table-column>
						<el-table-column prop="oldNum" label="提单号" width="100">
						</el-table-column>
					</el-table>
				</el-col>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShowCar=false">取 消</el-button>
				<el-button type="primary" v-if="addType" @click="saveMatchCarS">确 定</el-button>
				<el-button type="primary" v-if="!addType" @click="saveMatchCar">确 定</el-button>
			</div>
		</el-dialog>
		<!--出库单/计价单Dialog单车-->
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml" style=" width: 100%;">
				<font face="宋体">
					<div style="width: 100%; height: 50px;">
							
					</div>
					<el-row>
						<div id="" style="margin-left: 40%;margin-bottom: 20px; width: 65%;">
							<font face="宋体">
								<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
									润华集团成本计价单
								</div>
							</font>
						</div>
						<div id="" style="float: left;width: 60%;">
							购货单位：{{infoData.invoiceHeader}}
						</div>
						<div id="" style="float: left;width: 40%;">
							部门：{{companyName}}
						</div>
						<div id="" style="float: left;width:60%;">
							发票号：{{infoData.invoiceNum}}
						</div>
						<div id="" style="float: left;width: 40%; ">
							仓库：{{warehouseCovs(infoData)}}
						</div>
						<div id="" style="float: left;width: 60%; ">
							开票日期：{{infoData.invoiceDate}}
						</div>
					</el-row>
					<!--车牌号信息 开始-->
					<el-row style="padding-left:5px; margin-top:5px">
						<el-col :span="24">
							<div>
								<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 15px;margin:0 auto;color:#1F2D3D">
									<tr>
										<td width="250"><b>商品名称及规格</b></td>
										<!--<td width="50"><b>单位</b></td>-->
										<!--<td width="50"><b>数量</b></td>-->
										<td width="150"><b>成本价</b></td>
										<!--销售价-->
										<td width="150"><b>售价(不含税)</b></td>
										<!--含税销售价-->
										<td width="150"><b>售价(含税)</b></td>
										<!--差价-->
										<td width="150"><b>差价</b></td>
									</tr>
									<tr>
										<td width="250" height="100"><b>{{infoData.carSeriesName+infoData.modelName+infoData.configureName}}</b></td>
										<!--<td width="50"><b>辆</b></td>-->
										<!--<td width="50"><b>1</b></td>-->
										<td width="150" rowspan="2"><font size="5">{{infoData.carCost}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{(Number(infoData.saleOrderPrice)/1.17).toFixed(2)}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{infoData.saleOrderPrice}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{chaE}}</font></td>
										<!--<td width="150"><b>{{chaE}}</b></td>-->
									</tr>
									<tr>
										<td width="250"><b>{{infoData.vin}}</b></td>
									</tr>
								</table>
							</div>
						</el-col>
					</el-row>
					<el-row>
						<div>
							<div id="" style="float: left;width: 30%;">
								<!--时间：{{this.moment(new Date()).format("YYYY年MM月DD日")}}-->
							</div>
							<div style="margin-top: 10px;margin-right: 10%;text-align: right">
								<div>
									制单:&nbsp;{{this.$data.infoData.userName}}
								</div>
							</div>
						</div>
					</el-row>
					<div style="width: 100%; height: 102px;">
							
					</div>
				</font>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px;text-align: right">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<!--出库单/计价单Dialog一单多车-->
		<el-dialog tittl="打印" v-model="dayinFormShows" id="dvData" size="large">
			<div id="printHtmls" style=" width: 100%;">
				<font face="宋体" v-for="(list,index) in carList">
					<el-row>
						<div style="width: 100%; height: 50px;">
							
						</div>
						<div id="" style="margin-left: 40%;margin-bottom: 20px; width: 65%;">
							<font face="宋体">
								<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
									润华集团成本计价单
								</div>
							</font>
						</div>
						<div id="" style="float: left;width: 60%;">
							购货单位：{{infoData.invoiceHeader}}
						</div>
						<div id="" style="float: left;width: 40%;">
							部门：{{companyName}}
						</div>
						<div id="" style="float: left;width:60%;">
							发票号：{{infoData.invoiceNum}}
						</div>
						<div id="" style="float: left;width: 40%;">
							仓库：{{warehouseCov(list)}}
						</div>
						<div id="" style="float: left;width: 60%;">
							开票日期：{{infoData.invoiceDate}}
						</div>
					</el-row>
					<!--车牌号信息 开始-->
					<el-row style="padding-left:5px; margin-top:5px">
						<el-col :span="24">
							<div>
								<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 15px;margin:0 auto;color:#1F2D3D">
									<tr>
										<td width="250"><b>商品名称及规格</b></td>
										<!--<td width="50"><b>单位</b></td>-->
										<!--<td width="50"><b>数量</b></td>-->
										<td width="150"><b>成本价</b></td>
										<!--销售价-->
										<td width="150"><b>售价(不含税)</b></td>
										<!--含税销售价-->
										<td width="150"><b>售价(含税)</b></td>
										<!--差价-->
										<td width="150"><b>差价</b></td>
									</tr>
									<tr>
										<td width="250" height="100"><b>{{list.carSeries+list.modelName+list.configureName}}</b></td>
										<!--<td width="50"><b>辆</b></td>-->
										<!--<td width="50"><b>1</b></td>-->
										<td width="150" rowspan="2"><font size="5">{{list.carCost}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{(Number(list.saleOrderPrice)/1.17).toFixed(2)}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{list.saleOrderPrice}}</font></td>
										<td width="150" rowspan="2"><font size="5">{{chaEs[index]}}</font></td>
										
										<!--<td width="150"><b>{{chaE}}</b></td>-->
									</tr>
									<tr>
										<td width="250" height="50"><b>{{list.vin}}</b></td>
									</tr>
								</table>
							</div>
						</el-col>
					</el-row>
					<el-row>
						<div>
							<div id="" style="float: left;width: 30%;">
								时间：{{moment(new Date()).format("YYYY年MM月DD日")}}
							</div>
							<div style="margin-top: 10px;margin-right: 10%;text-align: right">
								<div>
									制单:&nbsp;{{infoData.userName}}
								</div>
							</div>
						</div>
					</el-row>
					<div style="width: 100%; height: 102px;">
							
					</div>
				</font>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px;text-align: right">
				<el-col>
					<el-button type="primary" @click="saveDayins">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
	</div>
</template>

<script>
	import carserice from '../../insPlugins/carSeries.vue'
	export default {
		data: function() {
			return {
				//新增发票的类型
				addType: false,
				//销售单显示框
				activeName: ['1', '2'],
				activeNames: "1",
				//仓库下拉
				warehouseType: [],
				//修改时不可修改
				readType: false,
				purchaseDate: "",
				//税额
				chaE: 0,
				//税额
				chaEs: [],
				//打印窗口单车
				dayinFormShow: false,
				//打印窗口多车
				dayinFormShows: false,
				//筛选车辆条件
				car: {
					saleType: "1",
					vin: "",
					//sale: "1",
				},
				//销货单位的下拉
				customerCombos: [],
				//筛选车辆显示
				comFormShowCar: false,
				//出生日期
				birthday: "",
				//开票日期
				invoiceDate: "",
				pidRea: false,
				carNumber: "1",
				saleType: [{
					label: '新开单',
					value: '0'
				}, {
					label: '已配车',
					value: '1'
				}, {
					label: '已开票',
					value: '2'
				}, {
					label: '已交车',
					value: '3'
				}],
				//formatWarehouse:"",
				infoDataList: [],
				infoData: {
					//车辆id
					carId: "",
					//进价
					carCost: "",
					saler: "",
					monthlyStatus: "",
					carSale: "",
					daxie: "",
					userName: "",
					formatWarehouse: "",
					id: "",
					saleOrderNum: "",
					customerName: "",
					contactPhone: "",
					owenName: "", //车主姓名
					owenPhone: "", //车主电话
					birthday: "",
					certificatesType: "",
					certificatesNum: "",
					modelName: "",
					carModelCode: "",
					configureName: "",
					configureCode: "",
					outsideColor: "",
					outsideColorCode: "",
					insideColor: "",
					insideColorCode: "",
					payType: "",
					payNum: "",
					invoiceHeader: "",
					saleStatus: "",
					companyId: "",
					//车架号
					vin: "",
					//发动机号
					engineNum: "",
					//销售金额
					saleOrderPrice: "",
					//车辆仓库
					warehouse: "",
					//初次入库时间
					firstEnterWarehouseDate: "",
					//发票号
					invoiceNum: "",
					//发票时间
					invoiceDate: "",
					//开票金额
					invoicePrice: "",
					//客户证件号码
					invoiceHeaderNum: "",
					//装具价格
					equipmentPrice: "",
					//延保价格
					exsurancePrice: "",
					//代办价格
					agencyPrice: "",
					//其他附加价格
					otherPrice: "",
					carCount: "1", //多车的车辆数
				},
				emptyInfoData: {
					//车辆id
					carId: "",
					//成本价
					carCost: "",
					saler: "",
					monthlyStatus: "",
					id: "",
					saleOrderNum: "",
					customerName: "",
					contactPhone: "",
					owenName: "", //车主姓名
					owenPhone: "", //车主电话
					birthday: "",
					certificatesType: "",
					certificatesNum: "",
					modelName: "",
					carModelCode: "",
					configureName: "",
					configureCode: "",
					outsideColor: "",
					outsideColorCode: "",
					insideColor: "",
					insideColorCode: "",
					payType: "",
					payNum: "",
					invoiceHeader: "",
					saleStatus: "",
					companyId: "",
					//车架号
					vin: "",
					//发动机号
					engineNum: "",
					//销售金额
					saleOrderPrice: "",
					//车辆仓库
					warehouse: "",
					//初次入库时间
					firstEnterWarehouseDate: "",
					//发票号
					invoiceNum: "",
					//发票时间
					invoiceDate: "",
					//开票金额
					invoicePrice: "",
					//客户证件号码
					invoiceHeaderNum: "",
					//装具价格
					equipmentPrice: "",
					//延保价格
					exsurancePrice: "",
					//代办价格
					agencyPrice: "",
					//其他附加价格
					otherPrice: "",
					carCount: "1", //多车的车辆数
				},
				rules: {
					contactPhone: [{
						required: true,
						message: '请输入客户号码',
						trigger: 'blur'
					}],
					invoiceNum: [{
						required: true,
						message: '请输入发票号',
						trigger: 'blur'
					}],
					invoiceNum: [{
						required: true,
						message: '请输入发票号',
						trigger: 'blur'
					}],
					//					invoiceDate: [
					//						{ required: true, message: '请输入发票时间', trigger: 'blur',type:'date' }
					//					],
					invoicePrice: [{
						required: true,
						message: '请输入发票金额',
						trigger: 'blur'
					}],
					saleOrderPrice: [{
						required: true,
						message: '请输入销售金额',
						trigger: 'blur'
					}],
					invoiceHeader: [{
						required: true,
						message: '请输入发票抬头',
						trigger: 'blur'
					}],
					certificatesNum: [{
						required: true,
						message: '请输入证件号码',
						trigger: 'blur'
					}],
					vin: [{
						required: true,
						message: '请选择车辆',
						trigger: 'blur'
					}],
					customerName: [{
						required: true,
						message: '请输入客户姓名',
						trigger: 'blur'
					}],

				},
				//按钮权限
				btnGroup: {},
				//添加
				carList: [],
				//新增窗口普票
				comFormShows: false,
				//新增窗口专票-多车
				comFormShowsL: false,
				//车系选择窗
				showStart: false,
				//客户选择窗
				showStarts: false,
				//查询条件-车型
				carModel: "",
				//日期
				data: {
					firstStart: "",
					firstStarts: ""
				},
				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				tableData: {
					total: 0,
					dataList: []
				},
				carStart: "",
				carStartComboData: [{
					value: '在途',
					label: '在途'
				}, {
					value: '已到达',
					label: '已到达'
				}],
				cardType: [{
					value: '身份证',
					label: '身份证'
				}],
				payType: [{
					value: '0',
					label: '刷卡'
				}, {
					value: '1',
					label: '现金'
				}, {
					value: '2',
					label: '转账'
				}, {
					value: '3',
					label: '支付宝'
				}, {
					value: '4',
					label: '混合支付'
				}],
				//车型名称--查询条件
				carModelCode: "",
				//车型名称--form表单
				carModelCodes: "",
				//选中的列
				multipleSelection: [],
				//车辆筛选选中的列
				multipleSelections: [],
				//查询条件
				carSelect: {
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//销售日期起
					saleDateStart: "",
					//销售日期至
					saleDateStop: "",
					//车主
					owner: "",
					//VIN
					vin: "",
					//作废状态
					status: "0",
					//打印状态
					printType:"0",
				},
				//查询条件
				carSelectS: {
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//销售日期起
					saleDateStart: "",
					//销售日期至
					saleDateStop: "",
					//车主
					owner: "",
					//VIN
					vin: "",
					//作废状态
					status: "0",
					//打印状态
					printType:"0",
				},
				//生成出库单需要的实体
				prientData: {
					vin: [],
					id: "",
					relationOrderNum: "",

				},
				//当前登录人的公司名称
				companyName: "",
				//车型名称
				carModelCode: "",
				//车型的下拉
				modelCombo: [],
				//配置的下拉--查询条件
				configCombo: [],
				//配置的下拉--form表单
				configCombos: [],
				//公司数据
				tableDataCar: {
					total: 0,
					dataList: []
				},
				//仓库转换
				levelConvertData: {},
				numberOrder: "", //销售单的编号预生成
				//作废状态的下拉
				statusCombo: [{
					label: '未作废',
					value: '0'
				}, {
					label: '已作废',
					value: '1'
				}, {
					label: '未匹配车辆',
					value: '2'
				}, ],
				//作废状态的下拉
				prentCombo: [{
					label: '未打印',
					value: '0'
				}, {
					label: '已打印',
					value: '1'
				}, ],
				inCar: {
					saleOrderId: [],
				}
			}
		},
		methods: {
			//移除车辆
			removeCar: function(index) {
				this.$data.carList.splice(index, 1);
			},
			//获取供货单位
			getCustomerCombo: function() {
				this.$http.get(this.API_ROOT + '/scm/provideCompany/combo', {
					params: {
						type: "1"
					}
				}).then((response) => {
					debugger;
					this.$data.customerCombos = response.data;
				}, (response) => {});
			},
			//发票抬头改变的回调
			changeCustomer: function() {
				debugger;
				var val = this.$data.infoData.invoiceHeader;
				for(var i = 0; i < this.$data.customerCombos.length; i++) {
					if(this.$data.customerCombos[i].customerNick = val) {
						this.$data.infoData.customerName = this.$data.customerCombos[i].customerNick;
						this.$data.infoData.contactPhone = this.$data.customerCombos[i].phoneNum;
						this.$data.infoData.certificatesNum = this.$data.customerCombos[i].licence;
						this.$data.infoData.owenPhone = this.$data.customerCombos[i].phoneNum;
					}
				}
				this.$data.showStarts = false;
				//debugger;
			},
			getCar: function() {
				if(this.$data.multipleSelection.length == 1 && this.$data.multipleSelection[0].status == "2") {
					this.$data.inCar.saleOrderId[0] = this.$data.multipleSelection[0].id;
					debugger;
					this.$http.post(this.API_ROOT + '/scm/saleOrder/ifCarIn', this.$data.inCar, {
						params: {
							//id: this.$data.multipleSelection[0].id
						}
					}).then((response) => {
						if(response.data.success) {
							this.$message(response.data.msg);
							this.query();
						} else {
							this.$message.error(response.data.msg);
						}

					}, (response) => {});

				} else {
					this.$message.error("请选择一条数据未匹配车辆的数据！");
				}
			},
			//作废
			toVoid: function() {
				if(this.$data.multipleSelection.length == 1) {
					this.$confirm('确认作废此张单据吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						//debugger;
						this.$http.get(this.API_ROOT + '/scm/saleOrder/saleOrderCancel', {
							params: {
								id: this.$data.multipleSelection[0].id
							}
						}).then((response) => {
							this.$message(response.data.msg);
							this.query();
						}, (response) => {});
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消此操作'
						});
					});

				} else {
					this.$message.error("请选择一条数据");
				}
			},
			getNum: function() {
				this.$http.get(this.API_ROOT + '/scm/common/invoiceSerialNumber', {
					params: {}
				}).then((response) => {
					//debugger;
					this.$data.numberOrder = response.data.serialNu; //清空时间
					this.$data.invoiceDate = "";
					this.$data.birthday = "";
					this.$data.infoData = Object.assign(this.$data.infoData, this.$data.emptyInfoData);
					this.$data.infoData.saleOrderNum = "SALE" + this.$data.numberOrder;

					this.$data.readType = false;
					this.$data.pidRea = false;
					this.$data.infoData.saleStatus = "0";
					this.saveNumber(response.data.serialNu); //更新流水号
				}, (response) => {});
			},
			//更新流水单号
			saveNumber: function(val) {
				this.$http.get(this.API_ROOT + '/scm/common/updateSerialNumber', {
					params: {
						currentSerial: val
					}
				}).then((response) => {
					//debugger;
				}, (response) => {});
			},

			//车辆数量改变
			//			carNumberChange:function(val){
			//				this.$data.saleOrderPrice=Number(this.$data.saleOrderPrice)*Number(val);
			//			},
			//清空查询条件
			clean: function() {
				this.$data.data.firstStart = "";
				this.$data.data.firstStarts = "";
				this.$data.carSelect = Object.assign(this.$data.carSelect, this.$data.carSelectS);
				this.$data.carModelCode = "";
				this.$data.carSelectCompany = "";
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				//debugger;
			},
			//车型改变的回调
			changeModels: function(val) {
				if(val != "") {
					this.comboConfigures(val);
				}
				//debugger;
			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					//debugger;
					this.$data.configCombo = response.data;
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//选择车型后的回调
			comboConfigures: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					//debugger;
					this.$data.configCombos = response.data;
					this.$data.addNoStoreFormData.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//查询选择的车辆
			carQuery: function() {
				this.$http.post(this.API_ROOT + '/scm/car/newPage', this.$data.car, {
					params: {
						status: "5"
						//start: this.$data.CurentPageCar,
						//limit: this.$data.pageCar.pageSize
					}
				}).then(resp => {
					resp.data.total = parseInt(resp.data.total);
					this.$data.tableDataCar = resp.data;
					//this.$data.tableDataCar.dataList = resp.data;
				}, resp => {});
			},
			//时间戳转换
			timeMoment: function(row, column) {
				return this.momentFu(row.createTime);
			},
			//状态转换
			saleCov: function(row, column) {
				var temp = '';
				switch(row.saleFalg) {
					case '0':
						temp = "未销售";
						break;
					case '1':
						temp = '已销售';
						break;
					default:
						''
						break
				};
				return temp;
			},
			//状态转换
			statusCov: function(row, column) {
				var temp = '';
				switch(row.outStatus) {
					case '0':
						temp = "未出库";
						break;
					case '1':
						temp = '已出库';
						break;
					default:
						temp = '未出库';
						break
				};
				return temp;
			},

			//作废状态转换
			statusCovs: function(row, column) {
				var temp = '';
				switch(row.status) {
					case '0':
						temp = "未作废";
						break;
					case '1':
						temp = '已作废'; //打印完的状态
						break;
					case '2':
						temp = '未匹配车辆'; //打印完的状态
						break;
					default:
						temp = row.status;
						break
				};
				return temp;
			},
			//发出仓库代码与名称转换
			warehouseCov: function(row, column) {
				debugger;
				return this.$data.levelConvertData[row.warehouseId];
			},
			warehouseCovs: function(row, column) {
				//debugger;
				return this.$data.levelConvertData[row.warehouse];
			},
			//打印出库单
			prientCar: function(val, type) {
				//debugger;
				//生成出库单的接口
				//debugger;
				debugger;
				if(type == "some") {
					if(val.id != "" && val.vin != "") {
						this.$data.prientData.vin = val.vin;
						this.$data.prientData.id = "";
						this.$data.prientData.relationOrderNum = val.id;
						this.$http.post(this.API_ROOT + '/scm/out/save', this.$data.prientData, {
							params: {
								type: 1
							}
						}).then(resp => {
							if(resp.data.success) {
								
								this.$data.dayinFormShows = true;
								//debugger;
								//this.$message.error(resp.data.msg);
								//this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
							//this.$data.dayinFormShows = true;
						}, resp => {})
					} else {
						this.$message("请选择车辆并保存！");
					}
				} else {
					if(val.id != "" && val.vin != "") {
						this.$data.prientData.vin = val.vin;
						this.$data.prientData.id = "";
						this.$data.prientData.relationOrderNum = val.id;
						this.$http.post(this.API_ROOT + '/scm/out/save', this.$data.prientData, {
							params: {
								type: 1
							}
						}).then(resp => {
							if(resp.data.success) {
								
								this.$data.dayinFormShow = true;
								//debugger;
								//this.$message.error(resp.data.msg);
								//this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
							//this.$data.dayinFormShow = true;
						}, resp => {})
					} else {
						this.$message("请选择车辆并保存！");
					}
				}

			},
			//打印出库单
			prientCars: function(val, type) {
				//debugger;
				//生成出库单的接口
				//debugger;
				debugger;
				if(type == "some") {
					if(val.id != "" && val.vin != "") {
						this.$data.prientData.vin = val.vin;
						this.$data.prientData.id = "";
						this.$data.prientData.relationOrderNum = val.id;
						this.$http.post(this.API_ROOT + '/scm/out/save', this.$data.prientData, {
							params: {
								type: 1
							}
						}).then(resp => {
							if(resp.data.success) {
//								this.prientOrders();
//								this.$data.dayinFormShows = true;
								//debugger;
								//this.$message.error(resp.data.msg);
								//this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
							
								this.$data.dayinFormShows = true;
						}, resp => {})
					} else {
						this.$message("请选择车辆并保存！");
					}
				} else {
					if(val.id != "" && val.vin != "") {
						this.$data.prientData.vin = val.vin;
						this.$data.prientData.id = "";
						this.$data.prientData.relationOrderNum = val.id;
						this.$http.post(this.API_ROOT + '/scm/out/save', this.$data.prientData, {
							params: {
								type: 1
							}
						}).then(resp => {
							if(resp.data.success) {
//								this.$data.dayinFormShow = true;
								//debugger;
								//this.$message.error(resp.data.msg);
								//this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
							
								this.$data.dayinFormShow = true;
						}, resp => {})
					} else {
						this.$message("请选择车辆并保存！");
					}
				}

			},
			//保存发票信息
			saveOrderF: function() {
				this.$refs.comForm.validate(function(valid, $event) {
					debugger;
					// 验证通过
					if(valid) {
						//debugger;
						this.$data.infoData.saleStatus = "2"
						debugger;
						this.$data.infoData.invoiceDate = this.momentFu(this.$data.invoiceDate);
						this.$http.post(this.API_ROOT + '/scm/saleOrder/save', this.$data.infoData.infoData, {
							params: {}
						}).then(resp => {
							if(resp.data.success) {
								//debugger;
								this.$message(resp.data.msg);
								this.$data.comFormShows = false;
								this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {})
					} else {
						return false
					}
				}.bind(this))
			},
			//保存单据
			saveOrder: function() {
				this.$refs.comForm.validate(function(valid, $event) {
					debugger;
					// 验证通过
					if(valid) {
						if(this.$data.infoData.vin == "") {
							this.$message.error("请选择车辆");
						} else {
							//debugger;
							this.$data.infoData.birthday = this.momentFu(this.$data.infoData.birthday);
							this.$data.infoData.invoiceDate = this.momentFu(this.$data.infoData.invoiceDate);
							this.$http.post(this.API_ROOT + '/scm/saleOrder/save', this.$data.infoData, {
								params: {}
							}).then(resp => {
								if(resp.data.success) {
									//debugger;
									this.$message(resp.data.msg);
									this.$data.comFormShows = false;
									this.query();
								} else {
									this.$message.error(resp.data.msg);
								}
							}, resp => {})
						}
					} else {
						return false
					}
				}.bind(this))
			},

			//保存单据
			saveOrderL: function() {
				this.$refs.comForm.validate(function(valid, $event) {
					debugger;
					// 验证通过
					if(valid && this.$data.carList.length > 0) {
						//debugger;
						this.$data.infoData.birthday = this.momentFu(this.$data.infoData.birthday);
						this.$data.infoData.invoiceDate = this.momentFu(this.$data.infoData.invoiceDate);

						var selections = {
							saveSale: this.$data.infoData,
							saleOrderList: this.$data.carList,
						}

						this.$http.post(this.API_ROOT + '/scm/saleOrder/saveSale', selections, {
							params: {}
						}).then(resp => {
							if(resp.data.success) {
								//debugger;
								this.$message(resp.data.msg);
								this.$data.comFormShowsL = false;
								this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {})
					} else {
						this.$message.error("信息不全！");
						return false;

					}
				}.bind(this))
			},

			//配车时保存单据
			saveOrders: function() {
				this.$data.infoData.birthday = this.momentFu(this.$data.birthday);
				this.$http.post(this.API_ROOT + '/scm/saleOrder/save', this.$data.infoData, {
					params: {}
				}).then(resp => {
					if(resp.data.success) {
						//debugger;
						this.$message(resp.data.msg);
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {})
			},
			//筛选车辆
			matchCar: function(val) {
				this.$data.comFormShowCar = true;
				this.carQuery();
				if(val == 0) {
					this.$data.addType = false;
				} else {
					this.$data.addType = true;
				}
			},
			saveMatchCar: function() {
				//debugger;
				if(this.$data.multipleSelections.length != 1) {
					this.$message.error("只能选择一辆车！");
				} else {
					debugger;
					var cars = this.$data.multipleSelections[0];
					this.$data.infoData.vin = cars.vin; //vin
					this.$data.infoData.engineNum = cars.engineNum; //发动机号
					this.$data.infoData.warehouse = cars.warehouseId; //所在仓库
					this.$data.infoData.modelName = cars.carModel; //车型
					//this.$data.infoData.warehouseId = cars.warehouseId; //车型
					this.$data.infoData.configureName = cars.configure; //配置
					this.$data.infoData.carId = cars.id; //车辆id，因为作废需要车辆id所有加此字段
					this.$data.infoData.firstEnterWarehouseDate = cars.enterWarehouseDateStart;
					this.$data.comFormShowCar = false;
					this.$data.infoData.saleStatus = "1";
					//this.fromWarehouseCov(this.$data.infoData.warehouse);
					//this.saveOrders();
				}
			},
			saveMatchCarS: function() {
				//debugger;
				var Selection = this.$data.multipleSelections.slice();
				for(var i = 0; i < Selection.length; i++) {
					var flog = true;
					for(var j = 0; j < this.$data.carList.length; j++) {
						if(this.$data.carList[j].vin == this.$data.multipleSelections[i].vin) {
							flog = false;
							this.$message.warning("有重复添加车辆，已自动过滤！");
							break;
						}
					}
					if(flog) {
						var cars = {};
						cars.carId = Selection[i].id; //车辆id
						cars.vin = Selection[i].vin; //车辆vin
						cars.engineNum = Selection[i].engineNum; //发动机号
						cars.warehouseId = Selection[i].warehouseId; //仓库
						cars.modelName = Selection[i].carModel; //车型名称
						cars.configureName = Selection[i].configure; //配置名称
						cars.firstEnterWarehouseDate = Selection[i].enterWarehouseDateStart; //初次入库时间
						cars.carModelId = Selection[i].carModelId; //车型id
						cars.configureId = Selection[i].configureId; //配置id

						cars.saleOrderPrice = ""; //车辆价格
						cars.equipmentPrice = ""; //装具价格
						cars.exsurancePrice = ""; //延保价格
						cars.agencyPrice = ""; //代办价格
						cars.otherPrice = ""; //其他附加价格
						debugger;
						this.$data.carList.push(cars);
					}
				}
				debugger;
				this.$data.infoData.carCount = this.$data.carList.length;
				this.$data.comFormShowCar = false;
			},

			//申请换车
			changeCar: function() {
				this.$message("已提交换车申请，请等待审批");
			},
			//新增销售单
			add: function() {
				//预加载单据号
				this.getNum();
				//清空车型名称
				this.$data.comFormShows = true;
			},

			//新增销售单
			adds: function() {
				//预加载单据号
				this.getNum();
				//清空车型名称
				this.$data.comFormShowsL = true;
				this.$data.carList = [];
			},

			//查看销售单信息
			edit: function() {
				//debugger;
				if(this.$data.multipleSelection.length == 1) {
					/*this.$http.get(this.API_ROOT + '/scm/monthlyBalance/monthlyBalance',{
					}).then((response) => {
					});*/
					//debugger;
					debugger;
					var resRoleData = this.$data.multipleSelection[0];
					if(resRoleData.vin == "" || resRoleData.vin == null) {
						this.$http.get(this.API_ROOT + '/scm/saleOrder/infoCar', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							

							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data.saleOrder);
							this.$data.carList = response.data.data.saleList;
							var mj = this.$data.infoData.monthlyStatus;
							debugger;
							if(mj == "0") {
								this.$data.comFormShowsL = true;
								this.$data.readType = true;
							} else {
								this.$message.error("月结不可修改");
							}
						}, (response) => {});
					} else {
						this.$http.get(this.API_ROOT + '/scm/saleOrder/info', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							//debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
							this.$data.infoData.warehouse = this.$data.infoData.warehouse;
							var mj = this.$data.infoData.monthlyStatus;

							if(mj == "0") {
								//alert(0);
								this.$data.comFormShows = true;
								this.$data.readType = true;
							} else {
								//alert(1);
								this.$message.error("月结不可修改");
							}
							//debugger;
						}, (response) => {
							// error callback
						});
					}
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//车型车系选择的回调
			insert: function(val, lable) {

				//debugger;
				if(this.$data.comFormShows == true) {
					this.$data.infoData.carModelCode = val;
					this.$data.carModelCodes = lable;
					this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
						params: {
							modelId: val
						}
					}).then((response) => {
						//debugger;
						this.$data.configCombos = response.data;
						this.$data.infoData.configure = "";
						//this.$message(response.data);
					}, (response) => {});

				} else {
					this.$data.carSelect.carSeriesCode = val;
					this.$data.carModelCode = lable;
					this.$http.get(this.API_ROOT + '/base/carModel/combo', {
						params: {
							seriesId: val
						}
					}).then((response) => {
						//debugger;
						this.$data.modelCombo = response.data;
						this.$data.carSelect.carModelCode = "";
						this.$data.carSelect.carConfigureCode = "";
						//this.$message(response.data);
					}, (response) => {});
				}
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//打开客户选择
			handleIconClickCustomer: function() {
				this.$data.showStarts = true;
			},
			//复选框回调函数
			handleSelectionChange: function(val) {
				//debugger;
				this.$data.multipleSelection = val;
			},
			//车辆筛选复选框回调函数
			handleSelectionChanges: function(val) {
				//debugger;
				this.$data.multipleSelections = val;
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				this.query();
			},
			//点击打印界面
			saveDayin: function() {
				var newstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShow = false;
				this.query();
			},
			//点击打印界面
			saveDayins: function() {
				var newstr = document.getElementById("printHtmls").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShows = false;
				this.query();
			},
			prints:function(){
				if(this.$data.multipleSelection.length == 1) {
					var resRoleData = this.$data.multipleSelection[0];
					if(resRoleData.vin == "" || resRoleData.vin == null) {
						this.$http.get(this.API_ROOT + '/scm/saleOrder/infoCar', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data.saleOrder);
							this.$data.carList = response.data.data.saleList;
							var selec = {};
							selec.vin = [];
							selec.id = resRoleData.id;
							for(var i = 0; i < this.$data.carList.length; i++) {
								selec.vin.push(this.$data.carList[i].vin);
							}
							debugger;
							this.prientCars(selec, "some"); //更改车辆状态
							this.prientOrders();
							//获取成本价-批量获取
							this.$http.post(this.API_ROOT + '/scm/saleOrder/carCostMore', selec.vin, {
								params: {}
							}).then((response2) => {
								//debugger;
								//var [] = response2.data;
								for(var i = 0; i < response2.data.dataList.length; i++) {
									this.$data.carList[i].carCost = response2.data.dataList[i].carCost;
									this.$data.chaEs[i] = ((Number(this.$data.carList[i].saleOrderPrice)/1.17).toFixed(2)   - response2.data.dataList[i].carCost).toFixed(2);
								}
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
								this.prientOrders();
								this.$data.dayinFormShows = true;
							});
							//var 
						}, (response) => {});
					} else {
						debugger;
						var vins = [];
						vins[0] = resRoleData.vin;
						var sele = {};
						sele.vin = vins.slice();
						sele.id = resRoleData.id;
						
						//获取销售单详情
						this.$http.get(this.API_ROOT + '/scm/saleOrder/info', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							this.prientCars(sele, "one"); //更改车辆状态
							
							//debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
							this.prientOrder();
							//this.$data.infoData.saleOrderPrice = this.getPrice(this.$data.infoData.vin);
							if(this.$data.infoData.saleOrderPrice == "" || this.$data.infoData.saleOrderPrice == null) {
								this.$data.infoData.saleOrderPrice = 0;
							}
							var vinTemp = this.$data.infoData.vin;
							//获取车辆的成本价
							this.$http.get(this.API_ROOT + '/scm/saleOrder/carCost', {
								params: {
									vin: vinTemp
								}
							}).then((response2) => {
								//debugger;
								//var [] = response2.data;
								this.$data.infoData.carCost = response2.data.carCost;
								var cost = response2.data.carCost;
								this.$data.chaE = ((Number(this.$data.infoData.saleOrderPrice)/1.17).toFixed(2) - this.$data.infoData.carCost).toFixed(2); //this.$data.infoData.saleOrderPrice - this.$data.infoData.carCost;
								//this.$data.chaE = this.$data.infoData.carCost-this.$data.infoData.saleOrderPrice;
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
								this.$data.infoData.daxie = this.daXie(cost);
								//debugger;
							});

							//debugger;
						}, (response) => {
							// error callback
						});
					}
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			printr:function(){
				debugger;
				if(this.$data.multipleSelection.length == 1&&this.$data.multipleSelection[0].status=='1') {
					var resRoleData = this.$data.multipleSelection[0];
					if(resRoleData.vin == "" || resRoleData.vin == null) {
						this.$http.get(this.API_ROOT + '/scm/saleOrder/infoCar', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data.saleOrder);
							this.$data.carList = response.data.data.saleList;
							var selec = {};
							selec.vin = [];
							selec.id = resRoleData.id;
							for(var i = 0; i < this.$data.carList.length; i++) {
								selec.vin.push(this.$data.carList[i].vin);
							}
							debugger;
							//this.prientCars(selec, "some"); //更改车辆状态
							//获取成本价-批量获取
							this.$http.post(this.API_ROOT + '/scm/saleOrder/carCostMore', selec.vin, {
								params: {}
							}).then((response2) => {
								//debugger;
								//var [] = response2.data;
								for(var i = 0; i < response2.data.dataList.length; i++) {
									response2.data.dataList[i].carCost=-Number(response2.data.dataList[i].carCost);
									this.$data.carList[i].saleOrderPrice=-Number(this.$data.carList[i].saleOrderPrice);
									this.$data.carList[i].carCost = response2.data.dataList[i].carCost;
									this.$data.chaEs[i] = ((Number(this.$data.carList[i].saleOrderPrice)/1.17).toFixed(2) - response2.data.dataList[i].carCost).toFixed(2);
								}
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
								//this.prientOrders();//duoche
								this.$data.dayinFormShows = true;
							});
							//var 
						}, (response) => {});
					} else {
						debugger;
						var vins = [];
						vins[0] = resRoleData.vin;
						var sele = {};
						sele.vin = vins.slice();
						sele.id = resRoleData.id;
						//this.prientCars(sele, "one"); //更改车辆状态
						//获取销售单详情
						this.$http.get(this.API_ROOT + '/scm/saleOrder/info', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							//debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
							//this.$data.infoData.saleOrderPrice = this.getPrice(this.$data.infoData.vin);
							if(this.$data.infoData.saleOrderPrice == "" || this.$data.infoData.saleOrderPrice == null) {
								this.$data.infoData.saleOrderPrice = 0;
							}
							var vinTemp = this.$data.infoData.vin;
							//获取车辆的成本价
							this.$http.get(this.API_ROOT + '/scm/saleOrder/carCost', {
								params: {
									vin: vinTemp
								}
							}).then((response2) => {
								response2.data.carCost=-Number(response2.data.carCost);
								this.$data.infoData.saleOrderPrice=-Number(this.$data.infoData.saleOrderPrice);
								this.$data.infoData.carCost = response2.data.carCost;
								var cost = response2.data.carCost;
								this.$data.chaE = ((Number(this.$data.infoData.saleOrderPrice)/1.17).toFixed(2)  - this.$data.infoData.carCost).toFixed(2); //this.$data.infoData.saleOrderPrice - this.$data.infoData.carCost;
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
								this.$data.infoData.daxie = this.daXie(cost);
								this.$data.dayinFormShow = true;
								//debugger;
							});

							//debugger;
						}, (response) => {
							// error callback
						});
					}
				} else {
					this.$message.error("请选择一条作废数据!");
				}
			},
			/*打印监听*/ //打印按钮
			print: function() {
				//alert("打印");
				if(this.$data.multipleSelection.length == 1) {
					var resRoleData = this.$data.multipleSelection[0];
					if(resRoleData.vin == "" || resRoleData.vin == null) {
						this.$http.get(this.API_ROOT + '/scm/saleOrder/infoCar', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data.saleOrder);
							this.$data.carList = response.data.data.saleList;
							var selec = {};
							selec.vin = [];
							selec.id = resRoleData.id;
							for(var i = 0; i < this.$data.carList.length; i++) {
								selec.vin.push(this.$data.carList[i].vin);
							}
							debugger;
							this.prientCar(selec, "some"); //更改车辆状态
							this.prientOrders();//获取流水号
							//获取成本价-批量获取
							this.$http.post(this.API_ROOT + '/scm/saleOrder/carCostMore', selec.vin, {
								params: {}
							}).then((response2) => {
								//debugger;
								//var [] = response2.data;
								for(var i = 0; i < response2.data.dataList.length; i++) {
									this.$data.carList[i].carCost = response2.data.dataList[i].carCost;
									this.$data.chaEs[i] = ((Number(this.$data.carList[i].saleOrderPrice)/1.17).toFixed(2) - response2.data.dataList[i].carCost).toFixed(2);
								}
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
							});
							//var 
						}, (response) => {});
					} else {
						debugger;
						var vins = [];
						vins[0] = resRoleData.vin;
						var sele = {};
						sele.vin = vins.slice();
						sele.id = resRoleData.id;
						this.prientCar(sele, "one"); //更改车辆状态
						
						//获取销售单详情
						this.$http.get(this.API_ROOT + '/scm/saleOrder/info', {
							params: {
								id: resRoleData.id
							}
						}).then((response) => {
							
							//debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
							this.prientOrder();//打印流水号
							//this.$data.infoData.saleOrderPrice = this.getPrice(this.$data.infoData.vin);
							if(this.$data.infoData.saleOrderPrice == "" || this.$data.infoData.saleOrderPrice == null) {
								this.$data.infoData.saleOrderPrice = 0;
							}
							var vinTemp = this.$data.infoData.vin;
							//获取车辆的成本价
							this.$http.get(this.API_ROOT + '/scm/saleOrder/carCost', {
								params: {
									vin: vinTemp
								}
							}).then((response2) => {
								//debugger;
								//var [] = response2.data;
								this.$data.infoData.carCost = response2.data.carCost;
								var cost = response2.data.carCost;
								this.$data.chaE = ((Number(this.$data.infoData.saleOrderPrice)/1.17).toFixed(2) - this.$data.infoData.carCost).toFixed(2); //this.$data.infoData.saleOrderPrice - this.$data.infoData.carCost;
								//this.$data.chaE = this.$data.infoData.carCost-this.$data.infoData.saleOrderPrice;
								// 获取登录用户名
								this.$data.infoData.userName = window.localStorage.getItem("userName");
								this.$data.infoData.daxie = this.daXie(cost);
								//debugger;
							});

							//debugger;
						}, (response) => {
							// error callback
						});
					}
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//调用打印记录接口--单车
			prientOrder: function() {
				debugger;
				var fromDatePrientList = [];
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					debugger;
					var fromDatePrient = {};
					fromDatePrient.carId = this.$data.infoData.carId;
					fromDatePrient.invoicesType = "5";
					fromDatePrient.invoicesPrice = Number(this.$data.infoData.saleOrderPrice);
					fromDatePrientList.push(fromDatePrient);
				};
				debugger;
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumber = resp.data;
				}, resp => {});
			},
			//调用打印记录接口--多车
			prientOrders: function() {
				debugger;
				var fromDatePrientList = [];
				for(var i = 0; i < this.$data.carList.length; i++) {
					debugger;
					var fromDatePrient = {};
					fromDatePrient.carId = this.$data.carList[i].carId;
					fromDatePrient.invoicesType = "5";
					fromDatePrient.invoicesPrice = Number(this.$data.carList[i].saleOrderPrice);
					fromDatePrientList.push(fromDatePrient);
				};
				debugger;
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumber = resp.data;
				}, resp => {});
			},
			//根据vin获取车辆的成本价格
			getPrice: function(vin) {
				this.$http.get(this.API_ROOT + '/scm/saleOrder/carCost', {
					params: {
						vin: vin
					}
				}).then((response) => {
						//debugger;
						return response.data.carCost;
						//debugger;
					}
					/*, (response) => {
											// error callback
										}*/
				);
			},

			/*金额中文大写转换*/
			daXie: function(n) {
				if(!/^(0|[1-9]\d*)(\.\d+)?$/.test(n))
					return "数据非法";
				var unit = "千百拾亿千百拾万千百拾元角分",
					str = "";
				n += "00";
				var p = n.indexOf('.');
				if(p >= 0)
					n = n.substring(0, p) + n.substr(p + 1, 2);
				unit = unit.substr(unit.length - n.length);
				for(var i = 0; i < n.length; i++)
					str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
				return str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
			},

			/*********************************仓库名称替换***************************/
			//发出仓库代码与名称转换
			fromWarehouseCov: function(www) {
				return this.$data.levelConvertData[www];
			},
			//仓库转换转换
			warehouseCovert: function() {
				this.$http.get(this.API_ROOT + '/scm/warehouse/convert', {
					params: {}
				}).then((response) => {
					this.$data.levelConvertData = response.data;
				}, (response) => {});
			},

			//查询
			query: function() {
				this.$data.carSelect.invoiceDateStart = this.momentFu(this.$data.data.firstStart);
				this.$data.carSelect.invoiceDateStop = this.momentFu(this.$data.data.firstStarts);
				//this.$data.carSelect = {};
				this.$http.post(this.API_ROOT + '/scm/saleOrder/page', this.$data.carSelect, {
					params: {
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableData = resp.data;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {})
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			getWarehouse: function() {
				//获取仓库下拉
				this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
					params: {
						group: "warehouse"
					}
				}).then((response) => {
					this.$data.warehouseType = response.data;
				}, (response) => {});
			},
		},
		components: {
			carserice
		},
		created: function() {
			this.query();
			this.warehouseCovert();
			this.getWarehouse();
			this.$data.companyName = window.localStorage.getItem("companyName");
			//获取供货单位
			this.getCustomerCombo();
			//按钮权限
			this.$http({
				method: 'GET',
				url: this.API_ROOT + '/rbac/login/btn', 
				params: { //发送的参数
					resPath: "scm/saleOrder", 
				}
			}).then(function(resp) {
				var btnData = resp.data.dataList;
				var temp = {};
				for(var i = 0; i < btnData.length; i++) {
					var btnName = btnData[i].btnName;
					temp[btnName] = btnName;
				}
				Object.assign(this.$data.btnGroup, temp);
			}, function(error) {
				// error
			})
		}
	}
</script>

<style>
	.box-card-sale {
		width: 100%;
		height: 200px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-card-car {
		width: 100%;
		height: 140px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
</style>